# Importing Data
INDIA<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Rubber/Rubber.xlsx",sheet = "Sheet1", range = "d1:d325")

# Checking the Imported Data
View(INDIA)
# Creating Time Series Data
INDIA_ts <- ts(INDIA, start=c(1991,1), end=c(2017,12), frequency=12)
# Viewing and Checking the Created Time Series Data
INDIA_ts
sum(is.na(INDIA_ts))
library(forecast)
INDIA_ts <- tsclean(INDIA_ts)
INDIA_ts

# Identification: Plotting the Time Series Data
plot(INDIA_ts)

# Estimating the appropriate model
INDIA_ts_model <- auto.arima(INDIA_ts)
INDIA_ts_model

# Forecasting
options(max.print=1000000)
INDIA_ts_forecast <- forecast (INDIA_ts_model, level=c(95), h=276)
plot(INDIA_ts_forecast)
INDIA_ts_forecast             

# Exporting
write.table(INDIA_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Rubber/INDIA_TSA.csv", sep=",")


